const s1 = Symbol()
const s2 = Symbol()
// console.log(s1 === s2)		//false

const key1 = Symbol('name')
const key2 = Symbol('name')
const symbolKyeObj = {
	[key1]:'name',
	[key2]:'name',
	name:'juehm'
}
console.log(symbolKyeObj, 'symbolKyeObj')
for (const key in symbolKyeObj) {
	console.log(key, 'forin')
}
console.log(Object.keys(symbolKyeObj), 'Object.keys')
console.log(Object.getOwnPropertyNames(symbolKyeObj), 'Object.getOwnPropertyNames')
console.log(JSON.stringify(symbolKyeObj), 'JSON.stringify(symbolKyeObj)')
console.log(Object.getOwnPropertySymbols(symbolKyeObj), 'Object.getOwnPropertySymbols(symbolKyeObj)')
console.log(Reflect.ownKeys(symbolKyeObj), 'Reflect.ownKeys')

// Symbol.for() Symbol.keyFor()

const s3 = Symbol.for('king')
const s4 = Symbol.for('king')
// console.log(s3 === s4)	//true

console.log(Symbol.keyFor(key2))
console.log(Symbol.keyFor(s4))

const obj2 = {
	[Symbol.hasInstance] (obj: any) {
		console.log(obj)
	}
}
console.log({a: 'a'} instanceof (obj2 as any))

let Oarray = [1, 2]
console.log([].concat(Oarray, [3, 4]))
Oarray[Symbol.isConcatSpreadable] = false
console.log([].concat(Oarray, [3, 4]))

class C extends Array {
	constructor (...args: number[]){
		super(...args)
	}
	static get [Symbol.species] () {
		return Array
	}
	getName(){
		return 'juehm'
	}
}
const c = new C(1, 2, 3)
console.log(c)
const a = c.map(item => item * 10)
console.log(a)
console.log(c instanceof C)
console.log(C instanceof Array)
console.log(a instanceof Array)

// Symbol.match
let obj3 = {
	[Symbol.match] (string: string | any[]) {
		console.log(string.length)
	}
}
'asfagwe'.match(<RegExp>obj3)

// Symbol.split
let obj4 = {
	[Symbol.split] (string: string | any[]) {
		console.log(string.length)
	}
}
'asfagwe'.split(<RegExp>obj4)

// Symbol.replace
// let obj9 = {
// 	[Symbol.replace] (string: string | any[]) {
// 		console.log(string.length)
// 	}
// }
// 'aasfagwe'.replace(<any>obj9)

// Symbol.search
let obj6 = {
	[Symbol.search] (string: string | any[]) {
		console.log(string.length)
	}
}
'asfagwe'.search(<RegExp>obj6)

// let obj7 = {
// 	a: 'a',
// 	b: 'b',
// 	c: 'c'
// }
// with (obj7) {
// 	console.log(a)
// 	console.log(b)
// 	console.log(c)
// }

console.log(Array.prototype[Symbol.unscopables])